import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;




public class principale extends JFrame {

	
	JPanel container = new JPanel();
	JPanel panel = new JPanel();
	JPanel top = new JPanel();
	JLabel topLabel = new JLabel("trouvez le bon bouton... ");
	JButton B = new JButton(new ImageIcon("no.jpg"));
	JButton B2 = new JButton();
	JButton B3 = new JButton();
	JButton B4 = new JButton();
	JButton B5 = new JButton();
	JButton B6 = new JButton();
	JButton B7 = new JButton();
	JButton B8 = new JButton();
	JButton B9 = new JButton();
	
	
	int suite_de_numero;
	int Stage;
	
	public principale()
		{
		 this.setSize(980, 600);
		 this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		 this.setLocationRelativeTo(null);
		 this.getContentPane().setLayout(new BorderLayout());
		 container.setBackground(Color.white);
		 container.setLayout(new BorderLayout());
		 this.setContentPane(container);
		 panel.setBackground(Color.black);
		 this.setVisible(true);
		// B.addActionListener(new BListener());
		 //B2.addActionListener(new B2Listener());
		// B3.addActionListener(new B3Listener());
		// B4.addActionListener(new B4Listener());
		// B5.addActionListener(new B5Listener());
		// B6.addActionListener(new B6Listener());
		// B7.addActionListener(new B7Listener());
		// B8.addActionListener(new B8Listener());
		// B9.addActionListener(new B9Listener());
		 
		 	GridLayout gl = new GridLayout();
			gl.setColumns(3);
			gl.setRows(3);
			panel.add(B);
			panel.add(B2);
			panel.add(B3);
			panel.add(B4);
			panel.add(B5);
			panel.add(B6);
			panel.add(B7);
			panel.add(B8);
			panel.add(B9);
			
			panel.setLayout(gl);
			gl.setVgap(5);
			gl.setHgap(5);
			container.add(panel, BorderLayout.CENTER);
			top.add(topLabel);
			container.add(top, BorderLayout.NORTH);
			
			
				
			
			
			
			
		}
	
	
	
	
	
	
	public void stage1()
	{
		Stage=1;
		suite_de_numero=1;
		
		
		B2.setEnabled(false);B2.setIcon(new ImageIcon("" ));
		B3.setEnabled(false);B3.setIcon(new ImageIcon("" ));
		B4.setEnabled(false);B4.setIcon(new ImageIcon("" ));
		B5.setEnabled(false);B5.setIcon(new ImageIcon("" ));
		B6.setEnabled(false);B6.setIcon(new ImageIcon("" ));
		B7.setEnabled(false);B7.setIcon(new ImageIcon("" ));
		B8.setEnabled(false);B8.setIcon(new ImageIcon("" ));
		
		B.setEnabled(true);B.setIcon(new ImageIcon("quest.jpg"));
		B9.setEnabled(true);B9.setIcon(new ImageIcon("quest.jpg"));
	}
	
	public void stage2()
	{
		Stage=2;
		suite_de_numero=1;
		
		
		
		B.setEnabled(false);B.setIcon(new ImageIcon(""));
		B5.setEnabled(false);B5.setIcon(new ImageIcon(""));
		B6.setEnabled(false);B6.setIcon(new ImageIcon(""));
		B8.setEnabled(false);B8.setIcon(new ImageIcon(""));
		B9.setEnabled(false);B9.setIcon(new ImageIcon(""));
		
		B2.setEnabled(true);B2.setIcon(new ImageIcon("quest.jpg"));
		B3.setEnabled(true);B3.setIcon(new ImageIcon("quest.jpg"));
		B4.setEnabled(true);B4.setIcon(new ImageIcon("quest.jpg"));
		B7.setEnabled(true);B7.setIcon(new ImageIcon("quest.jpg"));
		
		
	}
	
	public void stage3()
	{
		
		Stage=3;
		suite_de_numero=1;
		
		
		
		B2.setEnabled(false);B2.setIcon(new ImageIcon("" ));
		B6.setEnabled(false);B3.setIcon(new ImageIcon("" ));
		B8.setEnabled(false);B8.setIcon(new ImageIcon("" ));
		
		B.setEnabled(true);B.setIcon(new ImageIcon("quest.jpg"));
		B3.setEnabled(true);B3.setIcon(new ImageIcon("quest.jpg"));
		B4.setEnabled(true);B4.setIcon(new ImageIcon("quest.jpg"));
		B5.setEnabled(true);B5.setIcon(new ImageIcon("quest.jpg"));
		B7.setEnabled(true);B7.setIcon(new ImageIcon("quest.jpg"));
		B9.setEnabled(true);B9.setIcon(new ImageIcon("quest.jpg"));
		
		
	}

	
	public boolean Verif_suite(int num_suite)
	{
		if(suite_de_numero==num_suite)
		{
			suite_de_numero++;
			
			return true;
			
		}
		
		else
		{
			JOptionPane fausse = new JOptionPane();
			fausse.showMessageDialog(null, " FAUX !! ", "FAUX ",JOptionPane.ERROR_MESSAGE, null);
			JOptionPane confirme = new JOptionPane();
			int option = confirme.showConfirmDialog(null, "Voulez-vous recommencer?", "Restart ?", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
			if(option == JOptionPane.OK_OPTION)
				{
					stage1();
				}
			if(option == JOptionPane.NO_OPTION)
			{
				System.exit(0);
			}
			return false;
		}
	}
	
	public static void main(String[] args) {
		// TODO Auto-generated method stub

	}

}
